﻿#ifndef SCROLL_MODE_THREAD_H
#define SCROLL_MODE_THREAD_H

#include "libdaq/device/base_device.h"
#include <QSharedPointer>
#include <QThread>

class ScrollModeADCThread : public QThread
{
    Q_OBJECT
public:
    ScrollModeADCThread(const QSharedPointer<libdaq::device::LockzhinerBaseDevice> &base_device,
      QVector<bool> channel_state,
      std::vector<std::vector<float> >& data)
      : base_device_{base_device}
      , channel_state_(channel_state)
      , data_(data)
      {}

signals:
  void complete(int collection_count);

public Q_SLOTS:
  void start(Priority = InheritPriority);
  void quit();

protected:
  void run() override;

private:
  QVector<bool> channel_state_; // 各通道使能状态
  std::vector<std::vector<float> >& data_;  // 存储读取的数据
  std::atomic<bool> thread_is_running_ = false; // 线程是否运行
  QWeakPointer<libdaq::device::LockzhinerBaseDevice> base_device_; // 设备示例
  uint32_t collect_data_length_ = 0; // 单次采集的数据长度阈值
};

#endif // SCROLL_MODE_THREAD_H
